// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueResource from 'vue-resource'
import ElementUI from 'element-ui'
import $ from 'jquery'
import common from './common'
import 'element-ui/lib/theme-chalk/index.css'
import 'bootstrap/js/modal.js'
import 'bootstrap/js/dropdown.js'
import 'bootstrap/js/tooltip.js'
import 'font-awesome/css/font-awesome.css'
import 'summernote'
import 'summernote/dist/lang/summernote-zh-CN.js'
import 'summernote/dist/summernote.css'

import BaiduMap from 'vue-baidu-map'

// Vue.use(BaiduMap, {
//   // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
//   ak: 'bhEfNQDARs1b3pQ5SCymHrdZOhplftDV'
// })
Vue.use(VueResource);
Vue.use(ElementUI)

Vue.http.interceptors.push(function(request, next) {//拦截器
    request.credentials = false;
	if (common.getCookie('ADMIN_ACCESS_TOKEN')) {
		request.headers.set('ADMIN_ACCESS_TOKEN', common.getCookie('ADMIN_ACCESS_TOKEN'))
	}
	next((res)=>{
    //401 登陆过期跳转
    if(res.data.status == 40006){
      router.push("/loginPage");
      common.setCookie('ADMIN_ACCESS_TOKEN','')
    }
  })
})

Vue.config.productionTip = false


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
